package com.runen.infinitemovement.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.runen.infinitemovement.R;
import com.runen.infinitemovement.model.entity.ShopInfoEntity;
import com.runen.infinitemovement.tool.GlideUtils;

/**
 * Create by LiaoDuanHong
 * Create on 2021/01/10 18:07
 */
public class ShopAdapter extends BaseQuickAdapter<ShopInfoEntity.DataBean, BaseViewHolder> {
    private Context context;

    public ShopAdapter(Context context) {
        super(R.layout.item_shop);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, ShopInfoEntity.DataBean item) {
        ImageView iv_shop_img = holder.getView(R.id.iv_shop_img);
        GlideUtils.loadImage(context, item.cover, iv_shop_img);
        holder.setText(R.id.tv_shop_name, item.goodsName);
        holder.setText(R.id.tv_hozom_num, String.valueOf(item.tinder));
        String sale = "剩余:%s件";
        holder.setText(R.id.tv_sale_num, String.format(sale, item.stock));
    }
}
